#include "ClickSprite.h"

ClickSprite::ClickSprite() : MovingSprite() {
	bitmaps = new Slide();

	loadBitmap();

	ani->stop();
	ani->setSlide(bitmaps, .04);
}

void ClickSprite::loadBitmap() {
	bitmaps->image = al_load_bitmap("rsc/Misc/click/click.tga");
	al_convert_mask_to_alpha(bitmaps->image, al_map_rgb(157, 89, 39));
	bitmaps->slideHeight = 48;
	bitmaps->slideWidth = 32;
	bitmaps->numSlides = 32;
}

void ClickSprite::update() {
	if(ani->getCurrSlideNumber() == 31) {
		ani->stop();
		done = true;
	}
}

void ClickSprite::draw(Point<float> camPos) {
	if(!done) {
		al_draw_bitmap(ani->getImage(), pos.x - camPos.x - 16, pos.y - camPos.y - 48, 0);
	}
}

void ClickSprite::deleteImages() {
	al_destroy_bitmap(bitmaps->image);
	delete bitmaps;
}